//app.js
App({
  onLaunch: function () {
    wx.login({
      success: function (res) {
        wx.request({
          url: 'https://api.weixin.qq.com/sns/jscode2session',
          data: {
            appid: 'appid',
            secret: 'secret',
            js_code: res.code,
            grant_type: 'authorization_code'
          },
          method: 'GET',
          success: function (res) {
            //OPEN_ID = res.data.openid;//获取到的openid
            console.log(res.data.openid)
          }
        })
      }
    })

  }
})